Send Data from a Siemens PLC to Workload Orchestrator

Estimated reading time: 2 minutes

This use case shows how to create a flow that collects data from a Siemens device and sends the data to Workload Orchestrator for monitoring and analysis.

Prerequisites:

Collect Data From a Tag and Send it to Workload Orchestrator

To Subscribe to a topic on a Siemens device and send the data to Workload Orchestrator:

  1. In the OT Link Platform navigation panel, click  DeviceHub > Tags.

  2. Click on to copy the Raw Topic.
  3. In the navigation panel, click Flows. Click Go to Flows to open Flows in a new browser tab.
  4. Add a Datahub Subscribe node.
  5. Double-click the new node and paste the raw topic that you copied in step 2 into Topic.

  6. On your OT Link Platform browser tab, click DataHub in the navigation panel.
  7. Copy the raw Cloud Connector Topic under Topics.

  8. Back in Flows, add a DataHub Publish node. Paste the Cloud Connector topic into the Publish node.
  9. Connect the nodes and click Save to start sending the raw data from the device topic to Workload Orchestrator.

Use a Function Node to Trim Data

Our flow will currently send the entire contents of the JSON object that the subscribe node collects from the device topic. You can use Function nodes to trim the data before sending it to Workload Orchestrator.

Trimming data with functions can improve performance.

Example JSON from a Siemens device topic:

{“description”: “”, “success”: true, “datatype”: “word”, “timestamp”: 1539111251938, “registerId”: “C65B9F2A-CC3B-4CB4-A0BF-C26C130D0E2E”, “value”: 0, “deviceID”: “0A9921CA-198C-4556-9556-FBEB99958B3E”, “tagName”: “Siemens-1”}

To send just the datatype and registerId from the JSON:

  1. Use a Function node. Connect it between the two DataHub nodes as pictured below:

  2. Double-click the Function node. Enter the following lines of code to trim the data:

    var obj = JSON.parse(msg.payload); // Changes the message string into an object for easy access to the values.
    msg.payload = "datatype: "   obj.datatype   // Changes the message to print "datatype: <value>, registerId: <value>"
                  ", registerId: "   obj.registerId; // instead of printing every value.
    return msg;
    
  3. Click Done. Click Save to enable the changes to the flow.

Check the Results in Workload Orchestrator

  1. On Workload Orchestrator, click Tags for the Project and Company your Cloud Connector tag is under.
  2. Click on the Id for your Cloud Connector tag. It will say OT Link Platform as the Type.

  3. Click the RAW tab to view messages sent to the Workload Orchestrator topic. The screenshot below shows the datatype and registerId that we sent in Add a Function Node to Trim Data.